function ajax({ type = "get", url, data = {} ,headers} = {}) {
    return new Promise((resolve, reject) => {
        $.ajax({
            type,
            url,
            data,
            headers,
            success(data) {
                resolve([null, data])
            },
            error(err) {
                resolve([err, undefined])
            }
        })
    })
}

let api_url=`http://localhost:3000`



function getquery() {

    let search_obj = {}
    if(!location.search){
        return search_obj
    }
  
    
    let querystring = location.search.split("?")[1]
    // console.log(querystring);//searchvalue=asdada&a=1&b=2



    let queryarr = querystring.split("&")
    // console.log(queryarr);// ['searchvalue=asdada', 'a=1', 'b=2']



    
    queryarr.forEach(value => {


        let search_arr = value.split("=")
        // console.log(search_arr);//['searchvalue', 'asdada']    ['a', '1']  ['b', '2']

        search_obj[search_arr[0]] = decodeURI(search_arr[1])



    })
    // console.log(search_obj);//{searchvalue: 'asdada', a: '1', b: '2'}
    return search_obj
}

// encodeURI 编码
// decodeURI 解码